
compiler_plugin "FS.Plugins.Ext.Day"
{
    desc            =   "Allows representation of days using day names";
    examples        =   [ 'monday', 'Monday', 'today', 'yesterday at 8:30 am', 'Tuesday' ];
    type            =   "expr";
    precedence      =   1;  
    grammar_match   =   "$daynumber:@starttoken.value ( at $time:@time.tvaluestring )?";         
    defaults        =   {  "timeValue" : "0" };
    start_tokens    =   {
                            "today"  : 7,  "yesterday" : 8, "tomorrow" : 9,  
                            "Today"  : 7,  "Yesterday" : 8, "Tomorrow" : 9,							
							"sunday" : 0,  "monday" : 1, "tuesday" : 2, "wednesday" : 3, "thursday" : 4, "friday" : 5, "saturday" : 6, 
                            "Sunday" : 0,  "Monday" : 1, "Tuesday" : 2, "Wednesday" : 3, "Thursday" : 4, "Friday" : 5, "Saturday" : 6, 
                            "sun"    : 0,  "mon"    : 1, "tues"    : 2, "wed"       : 3, "thurs"    : 4, "fri"    : 5, "sat"      : 6, 
                            "Sun"    : 0,  "Mon"    : 1, "Tues"    : 2, "Wed"       : 3, "Thurs"    : 4, "Fri"    : 5, "Sat"      : 6
                        };
    build           =   function(args)
                        {       
                            return sys.compiler.ToRelativeDay( args["daynumberValue"], args["timeValue"], args["daynumber"] );
                        }
}